//===============================================================================
// Microsoft patterns & practices
// Web Client Software Factory
//-------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//-------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System;
using System.Collections.ObjectModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WCSFContrib.PageFlow.Tests.Mocks;

namespace WCSFContrib.PageFlow.Tests
{
	/// <summary>
	/// Summary description for PageFlowDefinitionCatalogFixture
	/// </summary>
	[TestClass]
	public class PageFlowDefinitionCatalogFixture
	{
		[TestMethod]
		public void CanCreatePageFlowDefinitionCatalog()
		{
			IPageFlowDefinitionCatalog catalog = new PageFlowDefinitionCatalog();

			Assert.IsNotNull(catalog);
		}

		[TestMethod]
		public void CanAddDefinitionToPageFlowDefinitionCatalog()
		{
			IPageFlowDefinitionCatalog catalog = new PageFlowDefinitionCatalog();
			catalog.Add(new MockPageFlowDefinition());

			Assert.AreEqual(1, catalog.Count);
		}

		[TestMethod]
		public void CanRemoveDefinition()
		{
			IPageFlowDefinition definition = new MockPageFlowDefinition();
			IPageFlowDefinitionCatalog catalog = new PageFlowDefinitionCatalog();
			catalog.Add(definition);

			int previousCount = catalog.Count;

			catalog.Remove(definition);

			Assert.AreEqual(previousCount - 1, catalog.Count);
		}

		[TestMethod]
		public void CanGetDefinitionByUrl()
		{
			IPageFlowDefinition definition = new MockPageFlowDefinition();
			IPageFlowDefinitionCatalog catalog = new PageFlowDefinitionCatalog();

			catalog.Add(definition);

			IPageFlowDefinition foundDefinition = catalog.GetByUrl("~/pageA.aspx");

			Assert.IsNotNull(foundDefinition);
			Assert.AreEqual(definition, foundDefinition);
		}
	}

}
